<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<link href="css/ydui.css" rel="stylesheet" type="text/css">
		<script src="https://g.alicdn.com/dingding/open-develop/1.6.9/dingtalk.js"></script>
		<script src="js/jquery-1.11.1.js"></script>
		<title>活动登记</title>
	</head>

	<body>
		<script src="js/ydui.flexible.js"></script>
		<script src="js/ydui.js"></script>
		<script>
			$(function() {
				if(dd.isDingtalk()) {
					dd.ready(function() {
						YDUI.dialog.loading.open('很快加载好了');
						/*var corpId = "ding452b085346482a0f"*/;//互邦
						var corpId = "ding721efb756aa874ba";//漳泽
						dd.runtime.permission.requestAuthCode({
							corpId: corpId,
							onSuccess: function(result) {
							/*	alert(JSON.stringify(result))*/
								var code = result.code;
								$.post("dingdingUser", {
									"code": code
								}, function(data) {
									YDUI.dialog.loading.close();
									/*alert(JSON.stringify(data))*/
									if(data.ok) {
										var userid=data.ok;
										sessionStorage.setItem("userid",userid)
										window.location.href="index2"
									} else {
										YDUI.dialog.alert(data.error,function(){
											window.location.href=""
										})										
									}
								})
							},
							onFail: function(err) {
								YDUI.dialog.loading.close();
								$.alert(JSON.stringify(err));
							}
						});
					});
				} else {
					/*getMyRole();*/
				}
			})
		</script>
	</body>

</html>